package day9;

import javax.swing.*;
import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class ClsTest2 {
    public static List gernateList(int type){
        if(type==1)
            return new LinkedList();
        else if(type==2){
            return new Vector();
        }else if(type==3){
            return new ArrayList();
        }else{
            return new Stack();
        }

    }
    public static void main(String[] args) throws ClassNotFoundException {
        //获得class的方式
        //1：类名.class
        //2: 对象的getClass
        //3: Class.forName
        Class c1=Class.forName("day9.Account");
        Class c2=Account.class;
        System.out.println(c1==c2);

        List list = gernateList((int) (Math.random() * 4));
        System.out.println("真正的类型："+list.getClass().getName());
    }
}
